#include "junix.h"

int print( const char *fpath,
		const struct stat *sb,
		int typeflag)
{
	printf("File Name:%s\n", fpath);

	if( typeflag ==FTW_F)
		printf("regular file\n");
	else if(typeflag == FTW_D)
	   printf("directory file\n");	
	else if(typeflag == FTW_DNR)
	   printf("directory not read\n");	

	printf("inode:%.llu\n",sb->st_ino);
	printf("size:%.llu\n",sb->st_size);

	return 0;
}

int main(int argc, char **argv)
{
	if( argc != 2)
		err_quit("Usage:%s dir",argv[0]);

	if( ftw( argv[1], print, 1) == -1)
		err_sys("ftw");

    exit(0);
}

